package bridgePattern;

public class Radio implements Device{
    private boolean on=false;
    private int percent= 60;
    private int channel = 5;
    @Override
    public boolean isEnabled() {
        return on;
    }

    @Override
    public void enable() {
        on=true;
    }

    @Override
    public void disable() {
        on=false;
    }

    @Override
    public int getVolume() {
        return 0;
    }

    @Override
    public void setVolume(int percent) {
        if (percent>100){
            this.percent=100;
        }if (percent<0){
            this.percent=0;
        }else{
            this.percent=percent;
        }
    }

    @Override
    public int getChannel() {
        return 0;
    }

    @Override
    public void setChannel(int channel) {
        this.channel=channel;

    }

    @Override
    public void printStatus() {
        System.out.println("------------------------------------");
        System.out.println("| I'm radio.");
        System.out.println("| I'm " + (on ? "enabled" : "disabled"));
        System.out.println("| Current volume is " + percent + "%");
        System.out.println("| Current channel is " + channel);
        System.out.println("------------------------------------\n");
    }
}
